import java.util.Scanner;

	
public class demo {
public static void main(String[] args) {
	int[] arr={00,10,20,30,40,50,60,70,80,90};
	Scanner in=new Scanner(System.in);
	print(arr);
	System.out.println("initial array length is "+arr.length );
	System.out.println("Enter the position");
	
	int pos=in.nextInt();
	
	int[] res=new int[arr.length+1];
	
	res=modifiedArray(arr,pos,88);
	
	
	System.out.println("Modified Array");
	print(res);
}
public static int[] modifiedArray(int[] arr,int pos,int item) {
	
	int[] mArray=new int[arr.length+1];
	int j=0;
	
	System.out.println("Modified array length is "+mArray.length);
	
	for(int i=0;i<arr.length;i++) {
		if(i< pos-1) {
			mArray[j++]=arr[i];
		}
		else{ 
		
			if(j<mArray.length) {
			mArray[pos-1]=item;
			
			mArray[++j]=arr[i];
			}
			
			
	}
	}
	
	
	return mArray;
}
	public static void print(int[] a){
		for(int i=0;i<a.length;i++) {
			System.out.println(a[i]);
		}
	}
}


